﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using AspNetCs.Common;
using System.Data;
using AspNetCs.Bll;
using System.Text;

public partial class OneHundredShow : BasePage
{
    protected string UserNameStr = "";
    /// <summary>
    /// 姓氏起源类别编号
    /// </summary>
    protected int ArticleClassId = 7;

    protected string articleContent = "";

    protected string allSameNames = "";

    protected void Page_Load(object sender, EventArgs e)
    {
        if (Request["Xing"] != null)
        {
            UserNameStr =Request["Xing"].Trim();
            GetDetail();
            names();
        }

    }

    public void GetDetail()
    {
        string cmdText = "select content from Article where title like '{0}' and ClassID={1} ";
        cmdText = string.Format(cmdText,UserNameStr.Trim(),ArticleClassId);
        DataTable dataTable = new DataTable();
        dataTable = ExcuteSqlTextBLL.GetDataTable(cmdText);
        if(dataTable.Rows.Count>0){
            articleContent = dataTable.Rows[0]["content"].ToString();
        }
    }


    public DataTable GetAllSameNames()
    {
        DataTable dataTable = new DataTable();
        string cmdText = "select (surname+username) as 'name' from  memorial where surname='{0}'";
        cmdText = string.Format(cmdText,UserNameStr.Trim());
        dataTable = ExcuteSqlTextBLL.GetDataTable(cmdText);
        return dataTable;
    }

    public void names()
    {
        StringBuilder sb=new StringBuilder();
        DataTable dataTable = GetAllSameNames();
        sb.Append("<div><ul>");
        foreach(DataRow row in dataTable.Rows)
        {

            sb.Append("<li style='float:left;width:80px;height:27px;'><span style='font-size:18px;'>" + row["name"].ToString() + "</span></li>");
        }
        sb.Append("</ul></div>");
        allSameNames=sb.ToString();
    }

}
